11 #define MAX(a, b) ((a) > (b) ? (a) : (b))
25 scanf("%d %d", &v
[i
], &w
[i
]);
28 for (j
=0; j
<=MAXC
; ++j
){
29 dp
[0][j
] = (j
< w
[0] ? 0 : v
[0]);
34 for (j
=1; j
<=MAXC
; ++j
){
35 dp
[i
][j
] = dp
[i
-1][j
];
37 dp
[i
][j
] = MAX(dp
[i
][j
], dp
[i
-1][j
-w
[i
]] + v
[i
]);
48 printf("%d\n", answer
);